package com.mangguo.tingjian.content.controller;


import com.mangguo.tingjian.common.Result;
import com.mangguo.tingjian.content.dto.SearchWordResult;
import com.mangguo.tingjian.content.service.IDwSearchWordService;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 热词搜索表 前端控制器
 * </p>
 *
 * @author auto
 * @since 2019-11-24
 */
@RestController
@RequestMapping("/content/dw-search-word")
@AllArgsConstructor
public class DwSearchWordController {

    private final IDwSearchWordService dwSearchWordService;

    @GetMapping("/top/{start}/{end}")
    public Result<List<SearchWordResult>> topSearchWords(@PathVariable("start") Integer start, @PathVariable("end") Integer end){
        return Result.success(dwSearchWordService.countTopSearchWordsBetweenDate(start, end));
    }
}
